housing <- read.table("http://www.jaredlander.com/data/housing.csv",
                      sep=",",header = TRUE,stringsAsFactors = FALSE)

names(housing) <- c("Neighborhood","Class","Units","YearBuilt",
                    "SqFt","Income","IncomePerSqFt","NetIncome","Value",
                    "ValuePerSqFt","Boro")
print(head(housing))

library(ggplot2)

gg <- ggplot(housing,aes(x=ValuePerSqFt)) + geom_histogram(binwidth = 10) +labs(x="Value per Square Foot")
print(gg)
gg <- ggplot(housing,aes(x=ValuePerSqFt,fill=Boro)) + geom_histogram(binwidth = 10) + labs(x="Value per Squre Foot")
print(gg)
gg <- gg + facet_wrap(~Boro)
print(gg)
print(ggplot(housing,aes(x=SqFt)) + geom_histogram())
print(ggplot(housing,aes(x=Units)) + geom_histogram())
print(ggplot(housing[housing$Units < 1000,],aes(x=SqFt)) +geom_histogram())
print(ggplot(housing[housing$Units < 1000,], aes(x=Units)) + geom_histogram())

print(ggplot(housing,aes(x=SqFt,y=ValuePerSqFt)) + geom_point())
print(ggplot(data = housing,aes(x=Units,y=ValuePerSqFt)) + geom_point())
print(ggplot(housing[housing$Units< 1000,],aes(x=SqFt,y=ValuePerSqFt)) + geom_point())
print(ggplot(housing[housing$Units< 1000,],aes(x=Units,y=ValuePerSqFt)) + geom_point())


